﻿app.controller('RedirectCtrl',
['$scope', '$window', '$state', '$stateParams', 'httpPlus', 'utils',
function ($scope, $window, $state, $stateParams, httpPlus, utils) {
    utils.setTitle('跳转中...');

    httpPlus
        .RRRApi('MemberCenterPage/CheckRegister')
        .then(function (_data) {
            if (_data.IsRegister) {
                if(_data.memberCardModel == '1'){
                    window.location.href='../../MemberCard/ReceiveWXMemberCard.aspx';
                }else {
                    $state.go('wx.register', {
                        backurl: $window.location.pathname + '#/wx/redirect?url=' + encodeURIComponent($stateParams.url)
                    });
                }
            } else {
                $window.location.href = '../../' + $stateParams.url;
            }
        });
}]);